/*
 * UsuarioHelper.java
 *
 * Created on 27 de Junho de 2007, 08:54
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package br.com.esp.agendafinanceira.helper;

import br.com.esp.agendafinanceira.controller.ApplicationConstants;
import br.com.esp.agendafinanceira.exception.I18NException;
import br.com.esp.agendafinanceira.form.UsuarioForm;
import javax.servlet.http.HttpServletRequest;
import org.omg.PortableServer.REQUEST_PROCESSING_POLICY_ID;

/**
 *
 * @author 003259L2
 */
public class UsuarioHelper extends AbstractHelper {
    
    /**
     *
     */
    private UsuarioForm usuario;
    
    /** Creates a new instance of UsuarioHelper */
    public UsuarioHelper(HttpServletRequest request) {
        super(request);
    }
    
    public void extractParameters() throws I18NException {
        usuario = (UsuarioForm) getRequest().getSession(false)
                    .getAttribute(ApplicationConstants.USER_OBJ_SESSION);
        validate();
    }
    
    public void validate() throws I18NException {
        if(usuario == null) {
            I18NException i18nex = new I18NException();
            i18nex.add("");
            throw i18nex;
        }
    }
    
    public UsuarioForm getUsuario() {
        return usuario;
    }
}
